home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / ADA / GCCMAIN / !gcc / gcc / h / fix-args < prev    next >
Text File  |  1996-01-13  |  2KB  |  60 lines

  1. /*----------------------------------------------------------------------*
  2.  * Bounds Checking for GCC.                        *
  3.  * Copyright (C) 1995 Richard W.M. Jones <rwmj@doc.ic.ac.uk>.        *
  4.  *----------------------------------------------------------------------*
  5.  * This program is free software; you can redistribute it and/or modify    *
  6.  * it under the terms of the GNU General Public License as published by    *
  7.  * the Free Software Foundation; either version 2 of the License, or    *
  8.  * (at your option) any later version.                    *
  9.  *                                    *
  10.  * This program is distributed in the hope that it will be useful,    *
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
  13.  * GNU General Public License for more details.                *
  14.  *                                    *
  15.  * You should have received a copy of the GNU General Public License    *
  16.  * along with this program; if not, write to the Free Software        *
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        *
  18.  *----------------------------------------------------------------------*
  19.  * File:
  20.  *    run-includes/fix-args.h.in
  21.  *    run-includes/fix-args.h (** generated automatically by make **)
  22.  * Summary:
  23.  *    Fix the definition of `va_arg' macro used both by <stdarg.h> and
  24.  *    <varargs.h>. You should include this file _after_ one of these
  25.  *    standard header files.
  26.  * Other notes:
  27.  *    Possibly this should be fixed automatically in `ginclude/'
  28.  *    files?
  29.  *    Because it seems to be impossible to redefine a macro in terms
  30.  *    of its old definition, I've done it in the Makefile that you will
  31.  *    find in this directory.
  32.  * Author          Date        Notes
  33.  * RWMJ        6/6/95        Initial implementation.
  34.  * RWMJ        12/1/96        Fixed to use fix-args.h.in
  35.  *----------------------------------------------------------------------*/
  36.  
  37. #ifndef _FIX_ARGS_H_
  38. #define _FIX_ARGS_H_
  39.  
  40. #ifdef __BOUNDS_CHECKING_ON
  41.  
  42. #undef va_arg
  43.  
  44. /* This is the definition of `__old_va_arg' copied from <stdarg.h>. It is
  45.  * identical to the one in <varargs.h> too.
  46.  */
  47. #define __old_va_arg(AP,TYPE) @@@@
  48.  
  49. #define va_arg(AP,TYPE) \
  50.   ({extern int __bounds_debug_no_checking; \
  51.   int __t = __bounds_debug_no_checking; \
  52.   TYPE __r; \
  53.   __bounds_debug_no_checking = 1; \
  54.   __r = __old_va_arg(AP,TYPE); \
  55.   __bounds_debug_no_checking = __t; \
  56.   __r;})
  57.  
  58. #endif /* __BOUNDS_CHECKING_ON */
  59. #endif /* _FIX_ARGS_H_ */
  60.